home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-11
/
vs_804.zip
/
MAINTSRC.EXE
/
GENINC.PRG
< prev
next >
Wrap
Text File
|
1991-10-25
|
6KB
|
209 lines
* Filename......: GenInc.Prg
*
* Author........: Vernon E. Six, Jr.
*
* Last Update...: Fri 10-25-1991 10:57:39
*
* Notice........: Copyright (c) 1991 by Vernon E. Six, Jr.
* All Rights Reserved World Wide
*
* Dialect.......: Clipper v5.0x
#include "INKEY.CH"
#include "SETCURS.CH"
#include "VERNSIX.CH"
FUNCTION GENINC
*****
* Generates individual CH files for each DATABASE
*****
LOCAL n_Prior
LOCAL c_Name
LOCAL n_Handle
LOCAL c_DbfPic
LOCAL c_Picture
LOCAL c_DefName
LOCAL c_DbfDef
LOCAL c_Default
LOCAL c_PicName
VS_GrabScr()
VS_TxtColr()
CLEAR SCREEN
_DICTHDR->( dbGoTop() )
DO WHILE .NOT. _DICTHDR->(EOF())
OUTSTD(_DICTHDR->DBF_NAME+" ... "+_DICTHDR->DESC+CHR(13)+CHR(10))
n_Handle := FCREATE(ALLTRIM(_DICTHDR->DBF_NAME)+".CH",0)
VS_WriteLn( n_Handle )
*══════════════════════════════════════════════════════════*
VS_WriteLn( "* Filename......: "+ALLTRIM(_DICTHDR->DBF_NAME)+".CH" )
VS_WriteLn( "*" )
VS_WriteLn( "* Author........: Vernon E. Six, Jr." )
VS_WriteLn( "*" )
VS_WriteLn( "* Last Update...: "+DTOC(DATE())+" "+TIME() )
VS_WriteLn( "*" )
VS_WriteLn( "* Notice........: Copyright (c) 1991 by Vernon E. Six, Jr." )
VS_WriteLn( "* All Rights Reserved World Wide" )
VS_WriteLn( "*" )
VS_WriteLn( "* Purpose.......: Data Dictionary DEFINEs for "+;
ALLTRIM(_DICTHDR->DBF_NAME)+".DBF" )
*══════════════════════════════════════════════════════════*
VS_WriteLn( "" )
VS_WriteLn( "" )
_DICTFLD->(DBSEEK(_DICTHDR->DBF_NAME))
DO WHILE .NOT. _DICTFLD->(EOF())
IF _DICTFLD->DBF_NAME <> _DICTHDR->DBF_NAME
EXIT
ENDIF
c_DefName = "_DEF_"+ALLTRIM(_DICTFLD->DBF_NAME) + ;
"_"+ALLTRIM(_DICTFLD->FIELD_NAME)
c_DbfDef = ALLTRIM(_DICTFLD->DEFAULT)
*****
* What type of data are we working with?
*****
DO CASE
CASE _DICTFLD->FIELD_TYPE = "C"
IF EMPTY(c_DbfDef)
c_Default = "SPACE("+ALLTRIM(STR(_DICTFLD->FIELD_LEN))+")"
ELSE
c_Default = c_DbfDef
ENDIF
CASE _DICTFLD->FIELD_TYPE = "N"
IF EMPTY(c_DbfDef)
c_Default = "0"
ELSE
c_Default = c_DbfDef
ENDIF
CASE _DICTFLD->FIELD_TYPE = "L"
IF EMPTY(c_DbfDef)
c_Default = [.F.]
ELSE
c_Default = c_DbfDef
ENDIF
CASE _DICTFLD->FIELD_TYPE = "D"
IF EMPTY(c_DbfDef)
c_Default = [DATE()]
ELSE
c_Default = c_DbfDef
ENDIF
ENDCASE
VS_WriteLn( "#DEFINE " + UPPER(PADR(c_DefName,40)) +c_Default )
_DICTFLD->(DBSKIP())
ENDDO
*══════════════════════════════════════════════════════════*
VS_WriteLn( "" )
VS_WriteLn( "" )
_DICTFLD->(DBSEEK(_DICTHDR->DBF_NAME))
DO WHILE .NOT. _DICTFLD->(EOF())
IF _DICTFLD->DBF_NAME <> _DICTHDR->DBF_NAME
EXIT
ENDIF
c_PicName = "_PIC_"+ALLTRIM(_DICTFLD->DBF_NAME) + ;
"_"+ALLTRIM(_DICTFLD->FIELD_NAME)
c_DbfPic = ALLTRIM(_DICTFLD->PICTURE)
*****
* What type of data are we working with?
*****
DO CASE
CASE _DICTFLD->FIELD_TYPE = "C"
IF EMPTY(c_DbfPic)
c_Picture = [REPLICATE("X",]+ALLTRIM(STR(_DICTFLD->FIELD_LEN))+")"
ELSe
c_Picture = c_DbfPic
ENDIF
CASE _DICTFLD->FIELD_TYPE = "N"
IF EMPTY(c_DbfPic)
IF _DICTFLD->FIELD_DEC > 0
n_Prior = (_DICTFLD->FIELD_LEN - _DICTFLD->FIELD_DEC) - 1
c_Picture = ["]+ REPLICATE("9",n_Prior) +"."+ REPLICATE("9",_DICTFLD->FIELD_DEC) + ["]
ELSE
c_Picture = ["] + REPLICATE("9",_DICTFLD->FIELD_LEN) + ["]
ENDIF
ELSE
c_Picture = c_DbfPic
ENDIF
CASE _DICTFLD->FIELD_TYPE = "L"
IF EMPTY(c_DbfPic)
c_Picture = ["Y"]
ELSE
c_Picture = c_DbfPic
ENDIF
CASE _DICTFLD->FIELD_TYPE = "D"
IF EMPTY(c_DbfPic)
c_Picture = ["99/99/99"]
ELSE
c_Picture = c_DbfPic
ENDIF
ENDCASE
VS_WriteLn( "#DEFINE " + UPPER(PADR(c_PicName,40)) +c_Picture )
_DICTFLD->(DBSKIP())
ENDDO
FCLOSE(n_Handle)
_DICTHDR->(DBSKIP())
ENDDO
_DICTHDR->( dbGoTop() )
VS_PutScr()
RETURN(NIL)
*** EOF: GenInc() ***********************************************************